#include <iostream>
#include <queue>
using namespace std;

int main(){
    int n;
    cin >> n;
    queue<char> q[n];
    for (int i = 0; i < n; ++i){
        string s;
        cin >> s;
        int len = s.length();
        
        for(int j = 0; j < len; ++j){
            char sec = (s[j]-'a'+1)%10+'0';
            cout << sec << endl;  
            char fir = char(int((s[j] - 'a'+1)/10)+'0');
            q[i].push(fir);
            q[i].push(sec);
        }
    }
    for(int i = 0; i < n; ++i){
        while(!q[i].empty()){
            cout << q[i].front();
            q[i].pop();
        }
        cout<<endl;
    }
    return 0;
}